const express = require('express');
const router = express.Router();
const OrderController = require('../controllers/orderController');
const authMiddleware = require('../middlewares/authMiddleware');

// 创建订单
router.post('/', authMiddleware, OrderController.createOrder);

// 获取订单列表
router.get('/', authMiddleware, OrderController.getOrders);

// 获取订单详情
router.get('/:id', authMiddleware, OrderController.getOrderById);

// 更新订单状态 (需要管理员权限)
router.put('/:id/status', authMiddleware, OrderController.updateOrderStatus);

// 取消订单
router.post('/:id/cancel', authMiddleware, OrderController.cancelOrder);

module.exports = router;